package com.example.app.components.MyTopBar

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.TopAppBarColors
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.TopAppBarScrollBehavior
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.example.app.components.MyDivider.MyDivider
import com.example.app.components.MyDivider.MyDividerDirection
import com.example.app.components.MyText.MyText
import com.example.app.ui.theme.listItemStartPadding

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MyTopBar(title: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    colModifier: Modifier = Modifier
        .padding(PaddingValues(listItemStartPadding / 2,
            0.dp))
        .fillMaxWidth(),
    navigationIcon: @Composable () -> Unit = {},
    actions: @Composable RowScope.() -> Unit = {},
    expandedHeight: Dp = TopAppBarDefaults.TopAppBarExpandedHeight,
    windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
    colors: TopAppBarColors = TopAppBarDefaults.centerAlignedTopAppBarColors(
        containerColor = Color.Transparent,
    ),
    scrollBehavior: TopAppBarScrollBehavior? = null,
    showDivider: Boolean = true) {
    Column(modifier = colModifier) {
        CenterAlignedTopAppBar(
            title = title,
            modifier = modifier,
            navigationIcon = navigationIcon,
            actions = actions,
            expandedHeight = expandedHeight,
            windowInsets = windowInsets,
            colors = colors,
            scrollBehavior = scrollBehavior,
        )

        if (showDivider) {
            MyDivider(myDividerDirection = MyDividerDirection.HOR)
        }
        
       
        
    }
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TestSomeThing(
    title: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    colModifier: Modifier = Modifier
        .padding(PaddingValues(listItemStartPadding / 2,
            0.dp))
        .fillMaxWidth(),
    navigationIcon: @Composable () -> Unit = {},
    actions: @Composable RowScope.() -> Unit = {},
    expandedHeight: Dp = TopAppBarDefaults.TopAppBarExpandedHeight,
    windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
    colors: TopAppBarColors = TopAppBarDefaults.centerAlignedTopAppBarColors(
        containerColor = Color.Transparent,
    ),
    scrollBehavior: TopAppBarScrollBehavior? = null,
    showDivider: Boolean = true
){
    Column(
        modifier = Modifier
            .padding(PaddingValues(listItemStartPadding / 2,
                0.dp))
            .fillMaxWidth()
    ) {
        MyText(text = "123")
    }
}
